package cn.cloud.project.openfeign.api.fallbackFactory;

import cn.cloud.project.openfeign.api.ProviderApiClient;
import feign.Request;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author: cql
 * @date: 2024/11/5
 * @description:
 */
@Component
public class ProviderApiFallbackFactory implements FallbackFactory<ProviderApiClient> {

    @Override
    public ProviderApiClient create(Throwable cause) {
        return new ProviderApiClient() {
            @Override
            public String test(String id) {
                return "执行降级FallbackFactory test";
            }

            @Override
            public String timeout() {
                return "执行降级FallbackFactory timeout";
            }

            @Override
            public String timeout(Request.Options options) {
                return "执行降级FallbackFactory timeout options";
            }

            @Override
            public String uploadImage(MultipartFile file) {
                return "执行降级FallbackFactory uploadImage";
            }
        };
    }

}
